<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>IDA SDK: Segment addressing</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">IDA SDK
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="files.html"><span>Header&#160;Files</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Segment addressing<div class="ingroups"><a class="el" href="group__seg.html">Segments</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga5aa3f21e8091747f90c4aba53018db25"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__addr.html#ga5aa3f21e8091747f90c4aba53018db25">get_segm_para</a> (const <a class="el" href="classsegment__t.html">segment_t</a> *s)</td></tr>
<tr class="memdesc:ga5aa3f21e8091747f90c4aba53018db25"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get segment base paragraph.  <a href="#ga5aa3f21e8091747f90c4aba53018db25">More...</a><br /></td></tr>
<tr class="separator:ga5aa3f21e8091747f90c4aba53018db25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2dc3df3c526b319baa6e89f261796400"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__addr.html#ga2dc3df3c526b319baa6e89f261796400">get_segm_base</a> (const <a class="el" href="classsegment__t.html">segment_t</a> *s)</td></tr>
<tr class="memdesc:ga2dc3df3c526b319baa6e89f261796400"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get segment base linear address.  <a href="#ga2dc3df3c526b319baa6e89f261796400">More...</a><br /></td></tr>
<tr class="separator:ga2dc3df3c526b319baa6e89f261796400"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga25f536b5ce889abea32a4aa7d50415fc"><td class="memItemLeft" align="right" valign="top"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> bool <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__seg__addr.html#ga25f536b5ce889abea32a4aa7d50415fc">set_segm_addressing</a> (<a class="el" href="classsegment__t.html">segment_t</a> *s, size_t bitness)</td></tr>
<tr class="memdesc:ga25f536b5ce889abea32a4aa7d50415fc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Change segment addressing mode (16, 32, 64 bits).  <a href="#ga25f536b5ce889abea32a4aa7d50415fc">More...</a><br /></td></tr>
<tr class="separator:ga25f536b5ce889abea32a4aa7d50415fc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga5aa3f21e8091747f90c4aba53018db25"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> get_segm_para </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsegment__t.html">segment_t</a> *&#160;</td>
          <td class="paramname"><em>s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get segment base paragraph. </p>
<p>Segment base paragraph may be converted to segment base linear address using <a class="el" href="ida_8hpp.html#a442b368394897f30bcd60bbc0b633019" title="Convert (seg,off) value to a linear address. ">to_ea()</a> function. In fact, to_ea(get_segm_para(s), 0) == get_segm_base(s). </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>pointer to segment </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if s == NULL, the segment base paragraph </dd></dl>

</div>
</div>
<a class="anchor" id="ga2dc3df3c526b319baa6e89f261796400"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> <a class="el" href="pro_8h.html#a7b0aeaed04e477c02cf8ea3452002d1a">ea_t</a> <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> get_segm_base </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsegment__t.html">segment_t</a> *&#160;</td>
          <td class="paramname"><em>s</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get segment base linear address. </p>
<p>Segment base linear address is used to calculate virtual addresses. The virtual address of the first byte of the segment will be (start address of segment - segment base linear address) </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>pointer to segment </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 if s == NULL, otherwise segment base linear address </dd></dl>

</div>
</div>
<a class="anchor" id="ga25f536b5ce889abea32a4aa7d50415fc"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="pro_8h.html#a8ddba56b40c4be92718f8059abf51147">idaman</a> bool <a class="el" href="pro_8h.html#a176294e75f953787714b9d08ffa89adf">ida_export</a> set_segm_addressing </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classsegment__t.html">segment_t</a> *&#160;</td>
          <td class="paramname"><em>s</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>bitness</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Change segment addressing mode (16, 32, 64 bits). </p>
<p>You must use this function to change segment addressing, never change the 'bitness' field directly. This function will delete all instructions, comments and names in the segment </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">s</td><td>pointer to segment </td></tr>
    <tr><td class="paramname">bitness</td><td>new addressing mode of segment<ul>
<li>2: 64bit segment</li>
<li>1: 32bit segment</li>
<li>0: 16bit segment </li>
</ul>
</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>success </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
